package com.pdg.android.splorr.data.baseclasses;

import android.content.Context;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;

public abstract class DataClient<T> {
	private T data;


	public DataClient(T theData){
		setData(theData);
	}
	
	private void setData(T theData) {
		data = theData;
	}
	
	public T getData(){
		return data;
	}

	public void load(SharedPreferences thePreferences) {
		onLoad(thePreferences);
	}


	protected abstract void onLoad(SharedPreferences thePreferences);

	public void commit(Editor theEditor) {
		onCommit(theEditor);
	}

	protected abstract void onCommit(Editor theEditor);
	
	public abstract Context getContext();
}
